<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      * {
        margin: 0;
        padding: 0;
      }
      .outer {
        height: 400px;
        border-bottom: 10px solid black;
        overflow: hidden;
      }
      .outer div {
        width: 50px;
        height: 50px;
        border-radius: 50%;
        background-color: red;
        float: left;
        margin-right: 50px;
        animation: ball 500ms ease-in forwards infinite alternate;
      }
      div.box2 {
        background-color: orange;
        animation-delay: 0.1s;
      }
      div.box3 {
        background-color: yellow;
        animation-delay: 0.2s;
      }
      div.box4 {
        background-color: green;
        animation-delay: 0.3s;
      }
      div.box5 {
        background-color: blue;
        animation-delay: 0.4s;
      }
      div.box6 {
        background-color: olive;
        animation-delay: 0.5s;
      }
      div.box7 {
        background-color: purple;
        animation-delay: 0.6s;
      }
      @keyframes ball {
        from {
          margin-top: 0;
        }
        /* 20%,
        60%,
        to {
          margin-top: 350px;
          animation-timing-function: ease-in;
        }
        40% {
          margin-top: 150px;
          animation-timing-function: ease-in;
        }

        80% {
          margin-top: 250px;
        } */
        to {
          margin-top: 350px;
        }
      }
    </style>
  </head>
  <body>
    <div class="outer">
      <div class="box1"></div>
      <div class="box2"></div>
      <div class="box3"></div>
      <div class="box4"></div>
      <div class="box5"></div>
      <div class="box6"></div>
      <div class="box7"></div>
    </div>
  </body>
</html>
